package him.action.coursemanage.course;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import him.action.Action;
import him.action.ActionForward;
import him.dto.coursemanage.CourseDTO;
import him.dto.coursemanage.SubjectDTO;
import him.service.CourseService;
import him.service.SubjectService;
import him.serviceimple.CourseServiceImple;
import him.serviceimple.SubjectServiceImple;

public class CourseListAction implements Action {

	@Override
	public ActionForward execute(HttpServletRequest request,
			HttpServletResponse response) {
		ActionForward actforward = new ActionForward();
		CourseService courseService = CourseServiceImple.getInstance();
		SubjectService subjectService = SubjectServiceImple.getInstance();
		//CourseDTO courseDTO = new CourseDTO();
		//SubjectDTO subjectDTO = new SubjectDTO();
		
		List<CourseDTO> courseList = courseService.getAllCourseList();
		List<SubjectDTO> subjectList = subjectService.getAllSubjectName();
		
		request.setAttribute("courseList", courseList);
		request.setAttribute("subjectList", subjectList);
		actforward.setUrl("courselist");
		
		return actforward;
	}

}
